/*
 * @Description: 通知公告
 * @Author: HuiSir<273250950@qq.com>
 * @Date: 2022-04-06 16:53:33
 * @LastEditTime: 2025-08-13 17:20:08
 */
import { useProjectConfig, rules2MockMethods } from "./_helpers";

const project = useProjectConfig();
const Prefix = "/msg/";

// 查询通知公告列表
const getMsgsByPage = {
  [project.responseFields.data]: {
    [`${project.responseDataSubFields.records}|15`]: [
      {
        id: "123",
        title: "@ctitle(5, 20)",
        status: 0, // 0-未读，1-已读
        createTime: "@datetime",
        updateTime: "@datetime",
        createUser: "@string('lower', 5)",
        updateUser: "@string('lower', 5)",
      },
      {
        id: "@id",
        title: "@ctitle(5, 20)",
        status: 0, // 0-未读，1-已读
        createTime: "@datetime",
        updateTime: "@datetime",
        createUser: "@string('lower', 5)",
        updateUser: "@string('lower', 5)",
      },
    ],
    page: 1,
    limit: 10,
    [project.responseDataSubFields.total]: 100,
    pageSize: 10,
  },
};

// 查询详情（标记已读）
const getMsgDetail = {
  [project.responseFields.data]: {
    id: "123",
    title: "@ctitle(5, 20)",
    status: 1, // 0-未读，1-已读
    content: "@cparagraph(1, 100)",
    createTime: "@datetime",
    updateTime: "@datetime",
    createUser: "@string('lower', 5)",
    updateUser: "@string('lower', 5)",
  },
};

// 删除通知公告
const delMsg = { [project.responseFields.message]: "删除成功" };

// 标记已读
const readById = { [project.responseFields.message]: "标记成功" };

// 全部标记已读
const readAll = { [project.responseFields.message]: "标记成功" };

const Rules: Record<string, unknown> = {
  getMsgsByPage,
  getMsgDetail,
  delMsg,
  readById,
  readAll,
};

export default rules2MockMethods(Rules, Prefix);
